type: object
properties:
  storageClass:
    oneOf:
      - type: string
      - type: boolean
        enum:
          - false
    x-examples:
      - false
      - default
    description: >
      The name of the StorageClass to use.

      If omitted, the StorageClass of the existing Loki PVC is used. If there is
      no PVC yet, either the [global
      StorageClass](../../deckhouse-configure-global.html#parameters-storageclass)
      or `global.discovery.defaultStorageClass` is used, and if those are
      undefined, the emptyDir volume is used to store the data.

      `storageClass: false` — forces the `emptyDir` usage. You will need to
      delete the old PVC and restart the Pod manually.

      **CAUTION!** Setting a value other than the current one (in the existing
      PVC) will cause the Loki volume to be re-provisioned and the data to be
      lost.
  diskSizeGigabytes:
    type: integer
    description: >
      Disk size for log storage or PVC size when specifying the
      [storageClass](#parameters-storageclass) parameters.

      You should manually specify the required disk size for storing logs for
      the period defined by the `retentionPeriodHours` parameter.

      Loki cannot automatically delete old data when the disk is full.

      The
      [extended-monitoring](../340-extended-monitoring/configuration.html#namespaced-kubernetes-objects)
      module automatically monitors the percentage of used disk space.

      **CAUTION!** If the Loki data disk becomes full, the application will stop
      working. You must find the right balance between `retentionPeriodHours`
      and `diskSizeGigabytes` values.
    x-doc-default: 2
    default: 2
  retentionPeriodHours:
    type: integer
    description: |
      How many hours to keep logs before deleting.
    x-doc-default: 168
    default: 168
  storeSystemLogs:
    type: boolean
    default: true
    x-doc-default: 'true'
    description: |
      Save logs from the `d8-*` namespaces to loki.

      The [log-shipper](../460-log-shipper) module must be enabled.
  nodeSelector:
    type: object
    additionalProperties:
      type: string
    description: >
      The same as the Pods' `spec.nodeSelector` parameter in Kubernetes.

      If the parameter is omitted or `false`, `nodeSelector` will be determined
      [automatically](https://deckhouse.io/documentation/v1/#advanced-scheduling).
  tolerations:
    type: array
    description: >
      The same as the Pods' `spec.tolerations` parameter in Kubernetes.

      If the parameter is omitted or `false`, `tolerations` will be determined
      [automatically](https://deckhouse.io/documentation/v1/#advanced-scheduling).
    items:
      type: object
      properties:
        effect:
          type: string
        key:
          type: string
        operator:
          type: string
        tolerationSeconds:
          type: integer
          format: int64
        value:
          type: string
  resourcesManagement:
    description: |
      Settings for CPU and memory requests and limits by Loki pods.
    default: {}
    x-examples:
      - mode: VPA
        vpa:
          mode: Auto
          cpu:
            min: 50m
            max: 2
            limitRatio: 1.5
          memory:
            min: 256Mi
            max: 2Gi
            limitRatio: 1.5
      - mode: Static
        static:
          requests:
            cpu: 55m
            memory: 256Mi
          limits:
            cpu: 2
            memory: 2Gi
    properties:
      mode:
        type: string
        description: |
          Resource management mode:
          - `Static` is a classic one. In it, you specify requests/limits. The parameters of this mode are defined in the [static](#parameters-resourcesmanagement-static) parameter section;
          - `VPA` mode uses [VPA](https://github.com/kubernetes/design-proposals-archive/blob/main/autoscaling/vertical-pod-autoscaler.md). You can configure this mode by modifying parameters in the [vpa](#parameters-resourcesmanagement-vpa) parameter section.
        enum:
          - VPA
          - Static
        default: VPA
      vpa:
        type: object
        default: {}
        description: |
          Resource management options for the `VPA` mode.
        properties:
          mode:
            type: string
            description: |
              VPA operating mode.
            enum:
              - Initial
              - Auto
            default: Auto
          cpu:
            type: object
            default: {}
            description: |
              CPU-related VPA settings.
            properties:
              max:
                description: |
                  The maximum value that the VPA can set for the CPU requests.
                default: 2
                oneOf:
                  - type: string
                    pattern: '^[0-9]+m?$'
                  - type: number
              min:
                description: |
                  The minimum value that the VPA can set for the CPU requests.
                default: 50m
                oneOf:
                  - type: string
                    pattern: '^[0-9]+m?$'
                  - type: number
              limitRatio:
                type: number
                examples:
                  - 1.5
                description: |
                  The CPU limits/requests ratio.

                  This ratio is used for calculating the initial CPU limits for a pod.

                  If this parameter is set, the VPA will recalculate the CPU limits while maintaining the specified limits/requests ratio.
          memory:
            type: object
            default: {}
            description: |
              Memory-related VPA settings.
            properties:
              max:
                description: |
                  The maximum memory requests the VPA can set.
                default: 2Gi
                oneOf:
                  - type: string
                    pattern: '^[0-9]+(\.[0-9]+)?(E|P|T|G|M|k|Ei|Pi|Ti|Gi|Mi|Ki)?$'
                  - type: number
              min:
                description: |
                  The minimum memory requests the VPA can set.
                default: 256Mi
                oneOf:
                  - type: string
                    pattern: '^[0-9]+(\.[0-9]+)?(E|P|T|G|M|k|Ei|Pi|Ti|Gi|Mi|Ki)?$'
                  - type: number
              limitRatio:
                type: number
                examples:
                  - 1.5
                description: |
                  The memory limits/requests ratio.

                  This ratio is used for calculating the initial memory limits for a pod.

                  If this parameter is set, the VPA will recalculate the memory limits while maintaining the specified limits/requests ratio.
      static:
        type: object
        description: |
          Resource management options for the `Static` mode.
        properties:
          requests:
            type: object
            description: |
              Resource requests settings for pods.
            properties:
              cpu:
                oneOf:
                  - type: string
                    pattern: '^[0-9]+m?$'
                  - type: number
                description: |
                  Configuring CPU requests.
              memory:
                oneOf:
                  - type: string
                    pattern: '^[0-9]+(\.[0-9]+)?(E|P|T|G|M|k|Ei|Pi|Ti|Gi|Mi|Ki)?$'
                  - type: number
                description: |
                  Configuring memory requests.
          limits:
            type: object
            description: |
              Configuring CPU and memory limits.
            properties:
              cpu:
                oneOf:
                  - type: string
                    pattern: '^[0-9]+m?$'
                  - type: number
                description: |
                  Configuring CPU limits.
              memory:
                oneOf:
                  - type: string
                    pattern: '^[0-9]+(\.[0-9]+)?(E|P|T|G|M|k|Ei|Pi|Ti|Gi|Mi|Ki)?$'
                  - type: number
                description: |
                  Configuring memory limits.
